package com.ruoyi.project.tickets.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.tickets.domain.Sale;
import com.ruoyi.project.tickets.domain.Serial;
import com.ruoyi.project.tickets.domain.Stock;
import com.ruoyi.project.tickets.domain.vo.SaleVo;
import com.ruoyi.project.tickets.domain.vo.SerialVo;
import com.ruoyi.project.tickets.domain.vo.StockVo;
import com.ruoyi.project.tickets.service.ISaleService;
import com.ruoyi.project.tickets.service.ISerialService;
import com.ruoyi.project.tickets.service.IStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author sunsahnwei
 * @date 2023年07月03日 10:34
 * @fileName ReportController
 */
@RestController
@RequestMapping("/tickets/reprot")
public class ReportController extends BaseController{


    @Autowired
    private ISaleService saleService;
    @Autowired
    private ISerialService serialService;

    @Autowired
    private IStockService stockService;

    @PreAuthorize("@ss.hasPermi('tickets:reprot:sale')")
    @GetMapping("/salelist")
    public TableDataInfo salelist(Sale sale)
    {
        startPage();
        List<SaleVo> list = saleService.selectReprotList(sale);
        return getDataTable(list);
    }
    @PreAuthorize("@ss.hasPermi('tickets:reprot:saleView')")
    @GetMapping("/detailsList/{shopId}")
    public AjaxResult detailsList(@PathVariable Long  shopId)
    {
        Sale sale=new Sale();
        sale.setShopId(shopId);
        List<SaleVo> list = saleService.selectSaleList(sale);
        return AjaxResult.success(list);
    }

    /**
     * 查询核销表列表
     */
    @PreAuthorize("@ss.hasPermi('tickets:serial:serial')")
    @GetMapping("/seriallist")
    public TableDataInfo seriallist(Serial serial)
    {
        startPage();
        List<SerialVo> list = serialService.selectSerialList(serial);
        return getDataTable(list);
    }
    @PreAuthorize("@ss.hasPermi('tickets:serial:stock')")
    @GetMapping("/stocklist")
    public TableDataInfo stocklist(Stock stock)
    {
        startPage();
        List<StockVo> list = stockService.selectStockList(stock);
        return getDataTable(list);
    }
}
